package com.heima.wemedia.controller.v1;

import com.heima.model.common.dtos.ResponseResult;
import com.heima.model.wemedia.dtos.WmMaterialDto;
import com.heima.wemedia.service.WmMaterialService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

/**
 * @program: heima-leadnews
 * @description: 自媒体素材管理控制器
 * @author: ryp
 * @create: 2023-04-26 16:03
 **/
@RestController
@RequestMapping("/api/v1/material")
public class WmMaterialController {

    @Autowired
    private WmMaterialService wmMaterialService;

    /**
     * 功能描述: 素材上传-图片
     *
     * @param multipartFile
     * @return : com.heima.model.common.dtos.ResponseResult
     */
    @PostMapping("/upload_picture")
    public ResponseResult uploadPicture(MultipartFile multipartFile) {

        return wmMaterialService.uploadPicture(multipartFile);
    }

    /**
     * 功能描述: 素材列表查询
     *
     * @param dto
     * @return : com.heima.model.common.dtos.ResponseResult
     */
    @PostMapping("/list")
    public ResponseResult findList(@RequestBody WmMaterialDto dto) {

        return wmMaterialService.findList(dto);
    }


}
